package com.netbao.sys.mapper;

import com.netbao.sys.model.User;
import com.netbao.sys.model.UserExample;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {
    @Insert("INSERT INTO sys_user(account,nickname,cname,`password`,idcard,phone,sex,eid,isdel,isstop,isadmin,roles,proid,isdispatcher,opid,remark," +
            "createtime,lasttime)\n" +
            "VALUES(#{account},#{nickname},#{cname},#{password},#{idcard},#{phone},#{sex},#{eid},#{isdel},#{isstop}," +
            "#{isadmin},#{roles},#{proid},#{isdispatcher},#{opid},#{remark},#{createtime},#{lasttime})")
    Integer addUser(User user);

    @Select("SELECT * FROM sys_user WHERE id=#{id}")
    User getById(Integer id);

    @Update("UPDATE sys_user SET account=#{account},nickname=#{nickname},cname=#{cname},`password`=#{password},idcard=#{idcard},phone=#{phone}," +
            "sex=#{sex},eid=#{eid},isdel=#{isdel},isstop=#{isstop},isadmin=#{isadmin},roles=#{roles},proid=#{proid},isdispatcher=#{isdispatcher}," +
            "opid=#{opid},remark=#{remark},createtime=#{createtime},lasttime=#{lasttime} where id=#{id}")
    Integer upDate(User user);

    @Delete("DELETE FROM sys_user WHERE id=#{id}")
    Integer del(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    long countByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int deleteByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int insert(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int insertSelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    List<User> selectByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    User selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_user
     *
     * @mbg.generated
     */
    int updateByPrimaryKey(User record);
}